#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char *argv[])
{
	if(argc!=10)
	{
		cout << "Use: Variable Start Number, Variable End Number, Variable Increase, Domain, Degree, Tuple Start, Tuple End," << endl
			<< "Batch Name, Output Name" << endl;
		return 1;
	}

	int Nstart=atoi(argv[1]);
	int Nend=atoi(argv[2]);
	int Ninc=atoi(argv[3]);
	int Do=atoi(argv[4]);
	int De=atoi(argv[5]);
	int Tstart=atoi(argv[6]);
	int Tend=atoi(argv[7]);

	ofstream output(argv[8]);
	
	for(int n=Nstart;n<=Nend;n+=Ninc)
	{
		for(int t=Tstart;t<=Tend;t++)
		{
			output << "echo Starting: " << n << ", " << t << endl;
			output << "csp.out -r " << n << ' ' << Do << ' ' << (n*De)/2 << ' ' << t << " 99 50 >" << argv[9] 
			<< '.' << n << '.' << Do << '.' << De << '.' << t << ".result" << endl;
			
		}
		output << endl;
		output << "echo Completed the " << n << " variable run." << endl << endl;
	}
}
